package com.lcz.authority.common.core.page;

import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * 分页查询返回对象
 *
 * @param <T> 泛型
 * @author leixiujie
 */
@Getter
@Setter
public class PageResult<T> {

    /**
     * 结果
     */
    private List<T> rows;

    /**
     * 总条数
     */
    private Long total;

    /**
     * 总页数
     */
    private Long totalPage;

    /**
     * 当前页码
     */
    private Integer pageNum;

    /**
     * 每页条数
     */
    private Integer pageSize;

    public PageResult() {
    }

    public PageResult(Long total, List<T> rows) {
        this.rows = rows;
        this.total = total;
    }

    public PageResult(Long total, List<T> rows, Integer pageNum, Integer pageSize) {
        this(total, rows);
        this.pageNum = pageNum;
        this.pageSize = pageSize;
    }

    public PageResult(Long total, Long totalPage, List<T> rows) {
        this(total, rows);
        this.totalPage = totalPage;
    }
}
